//
//  AYTCustomCell.m
//  AiYuanTai
//
//  Created by cdyqkj on 16/7/19.
//  Copyright © 2016年 sima. All rights reserved.
//

#import "AYTCustomCell.h"

@interface AYTCustomCell ()
@property (weak, nonatomic) IBOutlet UIView *zhifubaoView;
@property (weak, nonatomic) IBOutlet UIView *yinhangkaView;
@property (weak, nonatomic) IBOutlet UIView *weixinView;
@property (weak, nonatomic) IBOutlet UIImageView *zhifubaoImage;
@property (weak, nonatomic) IBOutlet UIImageView *yinhangkaImage;
@property (weak, nonatomic) IBOutlet UIImageView *weixinImage;
@property (nonatomic , strong) UIView *selectedView;
@end

@implementation AYTCustomCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [self.zhifubaoView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]];
    [self.yinhangkaView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]];
    [self.weixinView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]];
    self.zhifubaoImage.image = [UIImage imageNamed:@"Selected"];
    self.selectedView = self.zhifubaoView;
}
- (void)tap:(UITapGestureRecognizer *)tap
{
    
    self.zhifubaoImage.image = [UIImage imageNamed:@"Unselected"];
    self.yinhangkaImage.image = [UIImage imageNamed:@"Unselected"];
    self.weixinImage.image = [UIImage imageNamed:@"Unselected"];

    if (tap.view.tag == 22) {//支付宝
        self.zhifubaoImage.image = [UIImage imageNamed:@"Selected"];
        self.selectedView = self.zhifubaoView;
    } else if (tap.view.tag == 33) {//银行卡
        self.yinhangkaImage.image = [UIImage imageNamed:@"Selected"];
        self.selectedView = self.yinhangkaView;
    } else if (tap.view.tag == 44) {//微信
        self.weixinImage.image = [UIImage imageNamed:@"Selected"];
        self.selectedView = self.weixinView;
    }
}
- (IBAction)goToBuy:(UIButton *)sender {
    if ([self.customCellDelegate respondsToSelector:@selector(clickButton:andView:)]) {
        [self.customCellDelegate clickButton:sender andView:self.selectedView];
    }
}
- (IBAction)clickBackBtn:(UIButton *)sender {
    if ([self.customCellDelegate respondsToSelector:@selector(clickButton:andView:)]) {
        [self.customCellDelegate clickButton:sender andView:self.selectedView];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
